#!/bin/bash
AUTOR='Ricardo Brito do Nascimento'
EMAIL='ricardo[at]rbncurriculo.cjb.net'
VER='0.1'
DATE='20071115'
EOP=false
PARAMS=$@
PARAMS_=$PARAMS
TEMP=""
QUANTIA=$#
NEXT=0
READHUMAN=false
CMD=""

_header(){
echo -e "\033[40;34m "
	cat << fim
	AUTOR: $AUTOR
	EMAIL: $EMAIL
	VERSÃO: $VER
	DATA: $DATE
	LISENÇA: GPL
fim
echo -e "\033[40;34m \033[m"

#	echo -ne "\033[40;34m teste \033[m"
#	echo -e '\033[1;32;1;2m   teste  \033[m'
}
_help(){
	_msg Help;
	_usage;
}

_msg(){
	echo -e "\033[40;34m $@ \033[m \n";
}

_msgErro(){
	echo -e "\033[40;31m Erro: $@\n \033[m";
	exit 1;
}

_version(){
	echo -e "versão: $VER"
}

_usage(){
	echo -e "uso: $0 [-h --help] [-l] [-i] [--human-readable] [-F| --classify] dir\n"
}

_getopts(){
	while getopts i:l: opt
	  do
		case $opt in
			l) ls -l ;;
			i) ls -i ;;
			?) exit -1;;
		esac
	  done

}

_menu1(){
	while getopts "i:l:" opt
	do
		case $opt in
			l) ls -l $OPTARG --color;;
			i) ls -i $OPTARG --color;;
			?) exit -1;;
		esac
	done
}

_menu0(){
EOP=false
PARAMS=$@
PARAMS_=$PARAMS
TEMP=""
QUANTIA=$#
NEXT=0
READHUMAN=false
CMD=""

while (($NEXT < $QUANTIA)) && (! $EOP); do
	echo $NEXT;
	
	case ${PARAMS[$NEXT]} in
	     --help|-h|?)	_help; EOP=true;;
	--human-readable) 	READHUMAN=true;;
		      -*)	_getopts ${PARAMS[$NEXT]} ;;
		       *) 	_usage; exit 0;;
	esac	


	let NEXT++;

done


echo $EOP $PARAMS $QUANTIA

}

_menu(){
case $1 in
	-h|--help|?) _help ;;
	-a|--add)
		_msg "add" ;;
	--erro) _msgErro $*;;
	--*) exit 0;;
	*) _usage;;
esac
}

_while(){
while (($NEXT <= 10));
  do
	  echo $NEXT
	  ((NEXT++))
  done

}

_menu1 $PARAMS
